/*_____________________________________________________________________________
||
|| STM32 Baremetal Driver
||
|| Jinfeng Zhuang, 2024.W18
||
|| Additional Feature: SWIP wrapper
||_____________________________________________________________________________
*/

typedef volatile unsigned short VU16;

typedef struct
{
    VU16 CR1;
    VU16 RESERVED0;
    VU16 CR2;
    VU16 RESERVED1;
    VU16 SR;
    VU16 RESERVED2;
    VU16 DR;
    VU16 RESERVED3;
    VU16 CRCPR;
    VU16 RESERVED4;
    VU16 RXCRCR;
    VU16 RESERVED5;
    VU16 TXCRCR;
    VU16 RESERVED6;
    VU16 I2SCFGR;
    VU16 RESERVED7;
    VU16 I2SPR;
    VU16 RESERVED8;
} SPI_TypeDef;

// PP: Push-Pull, Output ONLY, like PWM
// OD: I2C, SPI, Input/Output
static void init(U32 base, U32 port, U32 pin, U32 pp)
{
    SPI_TypeDef* GPIOx = (SPI_TypeDef*)base;
    U32          tmp;
}

/*_____________________________________________________________________________
||
|| Wrapper of SWIP
||
|| Include Port related macros.
|| Self compile code, if user want use it, redefine the macros.
||
*/

enum SWIP_CMD
{
    SWIP_CMD_BASE,
};

static U32 reg_base[8];

static U32 event_handler_(U32 index, U32 cmd, U32 param1, U32 param2)
{
    switch (cmd)
    {
    case SWIP_CMD_BASE:
        reg_base[index] = param1;
        break;
    }
}